<?php

defined('SYSPATH') or die('No direct access allowed.');

//class Domain_Entities_Order extends Domain_Entities_Entity {
class Library_Payment_Data_Order extends Domain_Entities_Entity {

//Order
    protected $code;
    protected $status;  //
    protected $paid;    //
    protected $payment_method; //
    protected $domain;
    protected $description; //
    protected $type;
    protected $created;    
    protected $modified;

//Customer
    protected $customer_id; //
    protected $customer_name; //
    protected $customer_email; //
    protected $customer_phone; //
    protected $customer_address; //
//Recipient
    protected $receiver_name; //
    protected $receiver_email; //
    protected $receiver_phone; //
    protected $receiver_address;
//Details
    protected $__details;
    protected $__total_item;
    protected $__total_money;
    
    public function from_data_array($a_data) {
        parent::from_data_array($a_data);
        if(!empty($this->__details)){
            $details = array();
            foreach ($this->__details as $_detail){
                $detail = new Library_Payment_Data_Orderdetail();
                $detail->from_data_array($_detail);
                $details[] = $detail;
            }
            $this->__details = $details;
        }
    }
    
    public function add_new_detail(){
        $detail = new Library_Payment_Data_Orderdetail();
        if(empty($this->__details)){
            $this->__details = array();
        }
        $this->__details[] = $detail;
        return $detail;
    }

}

?>
